The SixBit Application Programming Interface > Examples > The SixBit API Sample Application > Testing API Calls |
The sample application includes the ability to provide the parameters to any SixBit API call and see the results. It also allows for specifying the location of a Drop Folder Automation File to perform API Calls. This application is very useful to assist in debugging API calls that are being made from other applications or from Drop Folder Automation files.
To run the sample application, simply double click the SixBit.API-SampleApplication.exe file in the SixBit installed directory. The sample application, like any other program written against the SixBit API, requires access to the SixBit executables and therefore should be run from the SixBit installed directory.
All calls made by the sample application will go against the database that was last loaded into SixBit on the running computer.
Testing Drop Folder Automation Files
To test a Drop Folder Automation File, simply choose Run the API calls in the Drop Folder Automation File:, provide the path to the file, then click Execute. The results of the call will appear in the OutputFilePath and LogFilePath locations specified in the API calls, or if changes to the data were made as a result of the call, the database can be checked to ensure the data has changed.
Testing API Calls
To test a specific call:
Example:
Let's look at the simple example of listing a buyers information and updating the zip code.
To list the information for the Buyer, we'll use the Buyers_List call. We could have chosen a buyer(s) by the BuyerID, a modified date range, or even a starting id and a count of buyers to be returned, but we knew the email address of the buyer so we entered that parameter. If multiple parameters were added, for example, if we added a Modified From date, then only results that meet all the parameter criteria will be returned. After clicking Execute, the list of matching buyers appears in the Results window.
To modify the buyers zip code, we're going to use the Buyers_AddUpdate call. This call will require us to provide a Buyers XML Element with the modified information. The easiest way to do this is to copy the Buyers element from the Buyers_List call and use that as the input for the AddUpdate call.
To perform the update, we need to specify an Action. 1=Add Only, 2=Update Only, and 3=AddOrUpdate. In our case, we want to perform an update, so an Action of 2 or 3 will provide the same results. The XML describing the changes to be made must also be provided. This is the result from the list call pasted back into the XML field. To make the change, we changed the value of the PostalCode field to 18840, then clicked Execute. When performing an update, only the fields that are being changed need to be provided, but since all the other fields were in the clipboard copy, we just left them.